package com.zhichat.infrastructure.Enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @ClassName: UserJoinTypeEnum
 * @Description: 用户好友申请验证开关enum
 * @Author: 团长九哥 https://space.bilibili.com/602197686
 * @CreateDate: 2024/11/16 20:52
 */
@Getter
@AllArgsConstructor
public enum UserJoinTypeEnum {
    /**
     * 1:允许任何人添加自己为好友
     * 2:不允许任何人添加自己为好友
     * 3:需要验证
     */
    ALLOW_ANY(1, "允许任何人添加自己为好友"),
    NOT_ALLOW_ANY(2, "不允许任何人添加自己为好友"),
    NEED_VERIFY(3, "需要验证");

    private final Integer code;
    private final String desc;

    public static UserJoinTypeEnum getByCode(Integer code) {
        for (UserJoinTypeEnum type : UserJoinTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
